home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.02 Feb 96 / Adding Scripts to Menus / Script Menu test project / Powering Up Code / SCModelProperty.h < prev    next >
Encoding:
Text File  |  1995-06-15  |  1.4 KB  |  53 lines  |  [TEXT/MMCC]

  1. // ===========================================================================
  2. // SCModelProperty.h -- a model property that automatically handles undo
  3. // 
  4. // ===========================================================================
  5. // © 1994 James Kaput, SimCalc Project
  6.  
  7. #pragma once
  8.  
  9. class     SCModelProperty : public LModelProperty {
  10.  
  11.     public:
  12.         SCModelProperty(DescType                inPropertyID,
  13.                     LModelObject            *inSuperModel);
  14.         ~SCModelProperty();
  15.                                         
  16.     protected:
  17.         //override
  18.         virtual void    HandleSetData(const AppleEvent    &inAppleEvent,
  19.                                 AppleEvent            &outAEReply);
  20. };
  21.  
  22. struct    SPropDesc {
  23.     DescType    id;
  24.     Str63        name;
  25. };
  26.  
  27. #define ALIGN_WORD if (stream.GetMarker() & 0x01) stream.SetMarker(1, streamFrom_Marker);
  28.  
  29.  
  30. class    SCSetPropertyAction : public LAction {
  31.     public:
  32.                     SCSetPropertyAction(LModelObject    *inObject,
  33.                                     DescType        inPropID,
  34.                                     const AppleEvent     &inAE);
  35.         virtual        ~SCSetPropertyAction();
  36.  
  37.         virtual void RedoSelf();
  38.         virtual void UndoSelf();
  39.         virtual void GetDescriptor(Str63 outDescription);
  40.         
  41.         // utilities for describing a property based on the 'aete'
  42.         static void            InitPropDescriptors();
  43.         static Boolean        DescribeProperty(DescType inPropID, Str63 outDescriptor);
  44.     
  45.     private:
  46.         LModelObject            *mObject;
  47.         StAEDescriptor            mNewData,
  48.                             mOldData;
  49.         DescType                mPropID;
  50.         
  51.         static    LDynamicArray    *sPropDescArray;    // descriptors of properties
  52.         
  53. };